package com.epoint.clubmanagement.entity;

import com.baomidou.mybatisplus.annotation.*;
import com.epoint.clubmanagement.common.DateUtil;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.validation.annotation.Validated;

import javax.validation.constraints.NotBlank;
import java.io.Serializable;
import java.util.Date;

/**
 * Title: ClubType
 * Description:  俱乐部类型
 *
 * @author sqn
 * @version 1.0.0
 * @date 2021/3/17 0017 上午 11:17
 */
@Data
@Validated
@TableName(value = "club_type")
public class ClubType implements Serializable {

    private static final long serialVersionUID = 1L;

    /**
     * 主键
     */
    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;

    /**
     * 类型名称
     */
    @NotBlank(message = "类型名称不能为空")
    @TableField(value = "type_name")
    private String typeName;

    /**
     * 创建时间
     */
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @TableField(value = "createtime")
    @ApiModelProperty(value = "创建时间")
    private Date createTime;

    /**
     * 修改时间
     * 填充字段
     */
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @TableField(value = "updatetime", fill = FieldFill.UPDATE)
    @ApiModelProperty(value = "修改时间")
    private Date updateTime;

    /**
     * 创建时间转换成年月日
     */
    public String getStrCreationTime() {
        return DateUtil.dateConvert(createTime);
    }

}
